package com.sdemo.utils.jedis;

import com.alibaba.fastjson.JSONObject;
import com.sdemo.modules.sys.model.User;

public class RedisTest {

	private static MyJedis myJedis = MyJedis.getInstance();
	
	
	private static String user_key ="user_key";
	public static void main(String[] args) {
		User user = new User();
		user.setUserId(1L);
		user.setNickname("test");
		user.setUsername("test1");
		
		myJedis.hset(user_key, "userid_1", JSONObject.toJSONString(user));
		
		
		
		String jsonUser = myJedis.hget(user_key, "userid_1");
		System.out.println(jsonUser);
		
		User jUser = JSONObject.parseObject(jsonUser, User.class);
		
		System.out.println(jUser.getNickname());
		
		myJedis.hdel(user_key, "userid_1");

	}

}
